]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/entry: Show hint actor while entry is focused
authorJonas Dreßler <verdre@v0yd.nl>
Wed, 22 Jan 2020 19:53:34 +0000 (20:53 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Thu, 23 Jan 2020 17:30:46 +0000 (17:30 +0000)
Also show the hint actor of an StEntry while the entry is focused but
has no text inside it. This is part of the new dialog and lock-screen
design where there are no labels before entries anymore and labels are
instead shown as a hint-text of the entry.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/944

src/st/st-entry.c

index feb90647bc5a4c8462245202e47e8253e3f5660d..741ba90ff8d0c82135e78f9944d1e8093c0d8bb4 100644 (file)
@@ -232,8 +232,7 @@ st_entry_update_hint_visibility (StEntry *self)
   StEntryPrivate *priv = ST_ENTRY_PRIV (self);
   gboolean hint_visible =
     priv->hint_actor != NULL &&
-    strcmp (clutter_text_get_text (CLUTTER_TEXT (priv->entry)), "") == 0 &&
-    !HAS_FOCUS (priv->entry);
+    strcmp (clutter_text_get_text (CLUTTER_TEXT (priv->entry)), "") == 0;
 
   if (priv->hint_actor)
     g_object_set (priv->hint_actor, "visible", hint_visible, NULL);
@@ -519,10 +518,6 @@ static void
 clutter_text_focus_in_cb (ClutterText  *text,
                           ClutterActor *actor)
 {
-  StEntry *entry = ST_ENTRY (actor);
-
-  st_entry_update_hint_visibility (entry);
-
   st_widget_add_style_pseudo_class (ST_WIDGET (actor), "focus");
   clutter_text_set_cursor_visible (text, TRUE);
 }
@@ -531,12 +526,7 @@ static void
 clutter_text_focus_out_cb (ClutterText  *text,
                            ClutterActor *actor)
 {
-  StEntry *entry = ST_ENTRY (actor);
-
   st_widget_remove_style_pseudo_class (ST_WIDGET (actor), "focus");
-
-  st_entry_update_hint_visibility (entry);
-
   clutter_text_set_cursor_visible (text, FALSE);
 }
 
@@ -548,6 +538,8 @@ clutter_text_changed_cb (GObject    *object,
   StEntry *entry = ST_ENTRY (user_data);
   StEntryPrivate *priv = ST_ENTRY_PRIV (entry);
 
+  st_entry_update_hint_visibility (entry);
+
   /* Since the text changed, force a regen of the shadow texture */
   cogl_clear_object (&priv->text_shadow_material);
 }
@@ -1039,10 +1031,8 @@ st_entry_get_text (StEntry *entry)
   g_return_val_if_fail (ST_IS_ENTRY (entry), NULL);
 
   priv = st_entry_get_instance_private (entry);
-  if (priv->hint_actor != NULL && clutter_actor_is_visible (priv->hint_actor))
-    return "";
-  else
-    return clutter_text_get_text (CLUTTER_TEXT (priv->entry));
+
+  return clutter_text_get_text (CLUTTER_TEXT (priv->entry));
 }
 
 /**
@@ -1064,8 +1054,6 @@ st_entry_set_text (StEntry     *entry,
 
   clutter_text_set_text (CLUTTER_TEXT (priv->entry), text);
 
-  st_entry_update_hint_visibility (entry);
-
   g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_TEXT]);
 }